// axios请求的baseURL
const API_BASE_URL = 'https://h5api.zhefengle.cn';//这个网站是开源的可以请求到数据的

module.exports = {
  target: 'static',
  env: {
    API_BASE_URL
  },
  /*
  ** Headers of the page
  */
  head: {
    title: '石榴庭院',
    titleTemplate: '%s-石榴庭院',
    meta: [
      { charset: 'utf-8' },
      { name: 'viewport', content: 'width=device-width, initial-scale=1' },
      { hid: 'keywords', name: 'keywords', content: '我是关键词' },
      { hid: 'description', name: 'description', content: '测试描述' },
    ],
    link: [
      { rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }
    ]
  },
  /*
  ** Customize the progress bar color
  */
  loading: { color: 'red' },
  // router:{
  //   middleware:['auth']
  // },
  modules: ['@nuxtjs/axios'],
  plugins: [
    {src: '~/plugins/router.js', ssr: false},
    {src: '~/plugins/common.js', ssr: true},
    {src: '~/plugins/axios.js', ssr: false},
    {src: '~/plugins/global.js', ssr: false},
  ],
  axios: {
    baseURL: API_BASE_URL, // Used as fallback if no runtime config is provided
    proxy: true,
    prefix: '/api/',
    credentials: true
  },
  proxy: {
    '/api/': {
      target: API_BASE_URL,//这个网站是开源的可以请求到数据的
      pathRewrite: {
        '^/api/': '/',
        changeOrigin: true
      }
    }
  },
  /*
  ** Build configuration
  */
  build: {
    /*
    ** Run ESLint on save
    */
    /*extend (config, { isDev, isClient }) {
      if (isDev && isClient) {
        config.module.rules.push({
          enforce: 'pre',
          test: /\.(js|vue)$/,
          loader: 'eslint-loader',
          exclude: /(node_modules)/
        })
      }
    }*/
  }
};

